package com.jcl.cloud.services.gateway.config;

import com.jcl.cloud.services.unicrawler.client.CrawlerManagerClient;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;


@Configuration
public class CrawlerGatewayConfig {


    @LoadBalanced
    @Bean
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }

    @Bean
    @ConditionalOnBean(RestTemplate.class)
    public CrawlerManagerClient crawlerManagerClient(RestTemplate restTemplate) {
        return new CrawlerManagerClient(restTemplate);
    }



}
